package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.RecruitRequire;
import com.wn55.hrms.mapper.RecruitRequireMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.bai~
 * @version 1.0
 * @date 2022/5/1 17:58
 */
@Service
public class RecruitRequireService {

    @Autowired
    RecruitRequireMapper recruitRequireMapper;

    public PageInfo<RecruitRequire> queryRequire(Integer now, Integer size, String deptName, String requireType, String postName) {
        PageHelper.startPage(now,size);

        List<RecruitRequire> list =  recruitRequireMapper.selectRequireByConds(deptName,requireType,postName);
        return new PageInfo<>(list);

    }

    public void removeBykey(int id) {
        recruitRequireMapper.deleteByPrimaryKey(id);
    }

    public void addRequire(RecruitRequire recruitRequire) {
        recruitRequireMapper.insertRequire(recruitRequire);
    }

    public void modify(RecruitRequire recruitRequire) {
        recruitRequireMapper.updateRequire(recruitRequire);
    }
}
